const http = require("http");
const db = require("./db");

http.createServer((req,res)=>{
    res.setHeader("Access-Control-Allow-Origin", "*")//跨域
    res.setHeader('Content-Type', 'text/html; charset=utf-8');//设置乱码
    let sql = "select * from web50 where name='李四'";
    db(sql,(err,result)=>{
        if(err){
            throw err;
        }else{
            console.log(666);
            res.end(JSON.stringify(result))
        }
    })
    
}).listen(3000)
console.log(111);